<template>
	<view class="wrap">
		<view class="device-sheet-header">
			<icon-text icon-path="order" :icon-position="0" :icon-text="sheetCount" :icon-size="30"></icon-text>
			<view class="header-right">
				<icon-text  v-if="pageType==0" icon-path="trash" :icon-position="0" icon-text="回收" :icon-size="30"></icon-text>
				<u-checkbox v-else v-model="isChecked" shape="circle">与我相关</u-checkbox>
			</view>
		</view>
		<u-line></u-line>
		<view class="device-sheet-content">
			<view v-for="(item,index) in sheetList" :key="index">
				<work-sheet-item
					:workSheet="item"
					:is-last="index === (sheetList.length-1)"
					@toDetail="toDetail(item)"
				></work-sheet-item>
			</view>
		</view>
	</view>
</template>
e
<script>
	import iconText from '@/components/icon-text.vue'
	import workSheetItem from '../mine/workSheet/components/work-sheet-item.vue'
	export default{
		components:{
			iconText,
			workSheetItem
		},
		data(){
			return{
				pageType:0,  //0 待处理 1 待维修 2 已修好
				cancelSheet:'回收(0)',
				isChecked:false,
				sheetList:[
					{
						orderNum:21060611,
						state:0,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},
					{
						orderNum:21060611,
						state:1,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},{
						orderNum:21060611,
						state:2,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},{
						orderNum:21060611,
						state:3,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},{
						orderNum:21060611,
						state:1,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},{
						orderNum:21060611,
						state:1,
						devName:'设备A',
						macAddres:'AD-23-SV-MB-22',
						faultReason:'接触不良',
						reportMan:'张三',
						reportTime:'2021-06-08 15:23:11',
						repairMan:'李四',
						repairTime:'2021-06-08 16:23:11',
					},
				],
			}
		},
		onLoad(option){
			if(option){
				this.pageType = option.pageType
			}
			uni.setNavigationBarTitle({
				title:option.title
			})
		},
		computed:{
			sheetCount(){
				return '共计'+this.sheetList.length+'条'
			}	
		},
		methods:{
			toDetail(item){
				// this.$u.route('/pages/deviceWorkSheet/workSheetDetail/index',{state:item.state})
			}
		},
	}
</script>

<style scoped lang="scss">
	.wrap{
		display: flex;
		flex-direction: column;
		height: calc(100vh);
		.device-sheet-header{
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 30rpx 20rpx;
			.header-right{
			}
		}
		.device-sheet-content{
			flex: 1;
			display: flex;
			flex-direction: column;
		}
	}
</style>
